package com.cs.bd.ad.http.bean;

import android.content.Context;
import android.text.TextUtils;

import com.cs.bd.ad.bean.AdModuleInfoBean;
import com.cs.bd.utils.StringUtils;

import org.json.JSONObject;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class BaseModuleDataItemBean implements Serializable {
    private static final long serialVersionUID = 1L;
    private static final String DEFAULT_VALUE_STRING = "";
    private static final int DEFAULT_VALUE_INT = 0;
    public static final String AD_DATA_SOURCE_TYPE_OFFLINE = "0";
    public static final String AD_DATA_SOURCE_TYPE_ONLINE = "1";
    public static final int DATA_TYPE_CHILD_MODULES = 1;
    public static final int DATA_TYPE_CONTENTS = 2;
    public static final int ADV_DATA_SOURCE_BIG_DATA_LOCAL_PRIORITY = 0;
    public static final int ADV_DATA_SOURCE_LOCAL_CONFIG = 1;
    public static final int AD_DATA_SOURCE_FACEBOOK_NATIVE = 2;
    public static final int ADV_DATA_SOURCE_CS_LAUNCHER_CLEAR_BIG_DATA = 3;
    public static final int ADV_DATA_SOURCE_CS_LAUNCHER_CLEAR_QUETTRA = 4;
    public static final int ADV_DATA_SOURCE_BIG_DATA_LOCAL_RECURRENCE = 5;
    public static final int ADV_DATA_SOURCE_PARR_BOGART = 6;
    public static final int ADV_DATA_SOURCE_MOBIVISTA = 7;
    public static final int AD_DATA_SOURCE_ADMOB = 8;
    public static final int AD_DATA_SOURCE_MOBILE_CORE_INTERSTITIAL = 9;
    public static final int AD_DATA_SOURCE_MOBILE_CORE_BANNER = 10;
    public static final int AD_DATA_SOURCE_FACEBOOK_INTERSTITIAL = 11;
    public static final int ADV_DATA_SOURCE_GENERAL_ONLINE_DATA = 12;
    public static final int ADV_DATA_SOURCE_INTELLIGENT = 13;
    public static final int ADV_DATA_SOURCE_LOCAL_CONFIG_CN = 14;
    public static final int ADV_DATA_SOURCE_INTELLIGENT_CLASSIFY = 15;
    public static final int AD_DATA_SOURCE_LOOP_ME = 16;
    public static final int AD_DATA_SOURCE_VUNGLE = 34;
    public static final int AD_DATA_SOURCE_APPLOVIN = 20;
    public static final int AD_DATA_SOURCE_CHEETAH = 21;
    public static final int AD_DATA_SOURCE_CS = 35;
    public static final int AD_DATA_SOURCE_S2S = 36;
    public static final int AD_DATA_SOURCE_IRONSCR = 37;
    public static final int AD_DATA_SOURCE_CHEETAH_VIDEO = 38;
    public static final int AD_DATA_SOURCE_MOPUB = 39;
    public static final int ONLINE_AD_SHOW_TYPE_BANNER = 1;
    public static final int ONLINE_AD_SHOW_TYPE_FULL_SCREEN = 2;
    public static final int ONLINE_AD_SHOW_TYPE_NATIVE = 3;
    public static final int ONLINE_AD_SHOW_TYPE_VIDEO = 4;
    public static final int ONLINE_AD_SHOW_TYPE_BANNER_300_250 = 5;
    public static final String CS_RAMDOM = "Z29yYW5kb20=";
    private int mModuleId;
    private int mAdvPositionId;
    private String mModuleName;
    private String mModuleDesc;
    private String mModuleSubTitle;
    private String mBackImage;
    private String mBanner;
    private String mPreview;
    private String mIcon;
    private String mUrl;
    private int mShowRandom;
    private int mCsRandom;
    private int mActType;
    private int mSequence;
    private int mPreLoadSwitch;
    private int mPreLoadSwitchType;
    private int mAdFrequency;
    private int mAdfirst;
    private int mAdsplit;
    private int mAdcolsetype;
    private int mOnlineAdvPositionId;
    private int mEffect;
    private int mAdvDataSource;
    private int mAdvScene;
    private int mFbAdvCount;
    private int mAdvDataSourceType;
    private int mFbAdvAbplan;
    private int mAdMobBanner;
    private int mOnlineAdvType;
    private String[] mFbIds;
    private int mFbAdvPos;
    private String mFbTabId;
    private int mFbNumperLine;
    private int mHasAnimation;
    private long mDataVersion;
    private int mDataType;
    private int mLayout;
    private int mPages;
    private int mPageId;
    private int mStatisticsType;
    private int mClearflag;
    private List<BaseModuleInfoBean> mChildModuleList;
    private List<BaseContentResourceInfoBean> mContentResourceInfoList;
    private long mSaveDataTime;
    private String mHasShowAdUrlList;
    private int mAdSplitInner;
    private int mClickEffect;
    private List<BaseModuleDataItemBean> mChildModuleDataItemList;
    private BaseResponseBean mBaseResponseBean;
    private int mVirtualModuleId;
    private int mAdCacheFlag;
    private long mRefreshDuration;
    private long mDuliteRefreshDuration;
    private String mAdidRelation;
    private int mIsVideo;
    private int mIsTransfer;

    public BaseModuleDataItemBean() {
    }

    public int getVirtualModuleId() {
        return this.mVirtualModuleId;
    }

    public void setVirtualModuleId(int virtualModuleId) {
        this.mVirtualModuleId = virtualModuleId;
    }

    public int getModuleId() {
        return this.mModuleId;
    }

    public void setModuleId(int moduleId) {
        this.mModuleId = moduleId;
    }

    public int getAdvPositionId() {
        return this.mAdvPositionId;
    }

    public void setAdvPositionId(int advPositionId) {
        this.mAdvPositionId = advPositionId;
    }

    public String getModuleName() {
        return this.mModuleName;
    }

    public void setModuleName(String moduleName) {
        this.mModuleName = moduleName;
    }

    public String getModuleDesc() {
        return this.mModuleDesc;
    }

    public void setModuleDesc(String moduleDesc) {
        this.mModuleDesc = moduleDesc;
    }

    public String getModuleSubTitle() {
        return this.mModuleSubTitle;
    }

    public void setModuleSubTitle(String moduleSubTitle) {
        this.mModuleSubTitle = moduleSubTitle;
    }

    public String getBackImage() {
        return this.mBackImage;
    }

    public void setBackImage(String backImage) {
        this.mBackImage = backImage;
    }

    public String getBanner() {
        return this.mBanner;
    }

    public void setBanner(String banner) {
        this.mBanner = banner;
    }

    public String getPreview() {
        return this.mPreview;
    }

    public void setPreview(String preview) {
        this.mPreview = preview;
    }

    public String getIcon() {
        return this.mIcon;
    }

    public void setIcon(String icon) {
        this.mIcon = icon;
    }

    public String getUrl() {
        return this.mUrl;
    }

    public void setUrl(String url) {
        this.mUrl = url;
    }

    public int getShowRandom() {
        return this.mShowRandom;
    }

    public void setShowRandom(int showRandom) {
        this.mShowRandom = showRandom;
    }

    public int getCsRandom() {
        return this.mCsRandom;
    }

    public void setCsRandom(int csRandom) {
        this.mCsRandom = csRandom;
    }

    public int getActType() {
        return this.mActType;
    }

    public void setActType(int actType) {
        this.mActType = actType;
    }

    public int getSequence() {
        return this.mSequence;
    }

    public void setSequence(int sequence) {
        this.mSequence = sequence;
    }

    public int getPreLoadSwitch() {
        return this.mPreLoadSwitch;
    }

    public void setPreLoadSwitch(int preLoadSwitch) {
        this.mPreLoadSwitch = preLoadSwitch;
    }

    public int getPreLoadSwitchType() {
        return this.mPreLoadSwitchType;
    }

    public void setPreLoadSwitchType(int preLoadSwitchType) {
        this.mPreLoadSwitchType = preLoadSwitchType;
    }

    public int getEffect() {
        return this.mEffect;
    }

    public void setEffect(int effect) {
        this.mEffect = effect;
    }

    public int getAdvDataSource() {
        return this.mAdvDataSource;
    }

    public void setAdvDataSource(int advDataSource) {
        this.mAdvDataSource = advDataSource;
    }

    public int getAdvScene() {
        return this.mAdvScene;
    }

    public void setAdvScene(int advScene) {
        this.mAdvScene = advScene;
    }

    public int getAdvDataSourceType() {
        return this.mAdvDataSourceType;
    }

    public void setAdvDataSourceType(int advDataSourceType) {
        this.mAdvDataSourceType = advDataSourceType;
    }

    public int getFbAdvCount() {
        return this.mFbAdvCount;
    }

    public void setFbAdvCount(int fbAdvCount) {
        this.mFbAdvCount = fbAdvCount;
    }

    public String[] getFbIds() {
        return this.mFbIds;
    }

    public void setFbIds(String[] fbIds) {
        this.mFbIds = fbIds;
    }

    public int getFbAdvPos() {
        return this.mFbAdvPos;
    }

    public void setFbAdvPos(int fbAdvPos) {
        this.mFbAdvPos = fbAdvPos;
    }

    public String getFbTabId() {
        return this.mFbTabId;
    }

    public void setFbTabId(String fbTabId) {
        this.mFbTabId = fbTabId;
    }

    public int getFbNumperLine() {
        return this.mFbNumperLine;
    }

    public void setFbNumperLine(int fbNumperLine) {
        this.mFbNumperLine = fbNumperLine;
    }

    public int getHasAnimation() {
        return this.mHasAnimation;
    }

    public void setHasAnimation(int hasAnimation) {
        this.mHasAnimation = hasAnimation;
    }

    public int getAdFrequency() {
        return this.mAdFrequency;
    }

    public void setAdFrequency(int adFrequency) {
        this.mAdFrequency = adFrequency;
    }

    public int getAdfirst() {
        return this.mAdfirst;
    }

    public void setAdfirst(int mAdfirst) {
        this.mAdfirst = mAdfirst;
    }

    public int getAdsplit() {
        return this.mAdsplit;
    }

    public void setAdsplit(int mAdsplit) {
        this.mAdsplit = mAdsplit;
    }

    public int getAdcolsetype() {
        return this.mAdcolsetype;
    }

    public void setAdcolsetype(int mAdcolsetype) {
        this.mAdcolsetype = mAdcolsetype;
    }

    public int getOnlineAdvPositionId() {
        return this.mOnlineAdvPositionId;
    }

    public void setOnlineAdvPositionId(int onlineAdvPositionId) {
        this.mOnlineAdvPositionId = onlineAdvPositionId;
    }

    public int getFbAdvAbplan() {
        return this.mFbAdvAbplan;
    }

    public void setFbAdvAbplan(int fbAdvAbplan) {
        this.mFbAdvAbplan = fbAdvAbplan;
    }

    public int getAdMobBanner() {
        return this.mAdMobBanner;
    }

    public void setAdMobBanner(int adMobBanner) {
        this.mAdMobBanner = adMobBanner;
    }

    public int getOnlineAdvType() {
        return this.mOnlineAdvType;
    }

    public void setOnlineAdvType(int onlineAdvType) {
        this.mOnlineAdvType = onlineAdvType;
    }

    public long getDataVersion() {
        return this.mDataVersion;
    }

    public void setDataVersion(long dataVersion) {
        this.mDataVersion = dataVersion;
    }

    public int getDataType() {
        return this.mDataType;
    }

    public void setDataType(int dataType) {
        this.mDataType = dataType;
    }

    public int getLayout() {
        return this.mLayout;
    }

    public void setLayout(int layout) {
        this.mLayout = layout;
    }

    public int getPages() {
        return this.mPages;
    }

    public void setPages(int pages) {
        this.mPages = pages;
    }

    public int getPageId() {
        return this.mPageId;
    }

    public void setPageId(int pageId) {
        this.mPageId = pageId;
    }

    public int getStatisticsType() {
        return this.mStatisticsType;
    }

    public void setStatisticsType(int statisticsType) {
        this.mStatisticsType = statisticsType;
    }

    public int getClearFlag() {
        return this.mClearflag;
    }

    public long getRefreshDuration() {
        return this.mRefreshDuration;
    }

    public long getDiluteRefreshDuration() {
        return this.mDuliteRefreshDuration;
    }

    public String getAdidRelation() {
        return this.mAdidRelation;
    }

    public void setClearFlag(int flag) {
        this.mClearflag = flag;
    }

    public List<BaseModuleInfoBean> getChildModuleList() {
        return this.mChildModuleList;
    }

    public void setChildModuleList(List<BaseModuleInfoBean> childModuleList) {
        this.mChildModuleList = childModuleList;
    }

    public List<BaseContentResourceInfoBean> getContentResourceInfoList() {
        return this.mContentResourceInfoList;
    }

    public void setContentResourceInfoList(List<BaseContentResourceInfoBean> contentResourceInfoList) {
        this.mContentResourceInfoList = contentResourceInfoList;
    }

    public void setSaveDataTime(long saveDataTime) {
        this.mSaveDataTime = saveDataTime;
    }

    public long getSaveDataTime() {
        return this.mSaveDataTime;
    }

    public void setHasShowAdUrlList(String hasShowAdUrlList) {
        this.mHasShowAdUrlList = hasShowAdUrlList;
    }

    public String getHasShowAdUrlList() {
        return this.mHasShowAdUrlList;
    }

    public void setAdSplitInner(int split) {
        this.mAdSplitInner = split;
    }

    public int getAdSplitInner() {
        return this.mAdSplitInner;
    }

    public void setClickEffect(int effect) {
        this.mClickEffect = effect;
    }

    public int getClickEffect() {
        return this.mClickEffect;
    }

    public void setChildModuleDataItemList(List<BaseModuleDataItemBean> childModuleDataItemList) {
        this.mChildModuleDataItemList = childModuleDataItemList;
    }

    public List<BaseModuleDataItemBean> getChildModuleDataItemList() {
        return this.mChildModuleDataItemList;
    }

    public int getAdCacheFlag() {
        return this.mAdCacheFlag;
    }

    public boolean isSdkOnlineAdType() {
        return "1".equals(String.valueOf(this.getAdvDataSourceType())) && this.getOnlineAdvPositionId() <= 0 && this.getAdvDataSource() != 35 && this.getAdvDataSource() != 36;
    }

    public boolean isOfflineAdType() {
        return "0".equals(String.valueOf(this.mAdvDataSourceType));
    }

    public List<BaseAppInfoBean> getAppInfoList() {
        if (this.mContentResourceInfoList != null && !this.mContentResourceInfoList.isEmpty()) {
            List<BaseAppInfoBean> appInfoList = new ArrayList();
            Iterator var2 = this.mContentResourceInfoList.iterator();

            while(var2.hasNext()) {
                BaseContentResourceInfoBean contentResourceInfoBean = (BaseContentResourceInfoBean)var2.next();
                if (contentResourceInfoBean != null && contentResourceInfoBean.getAppInfoBean() != null) {
                    appInfoList.add(contentResourceInfoBean.getAppInfoBean());
                }
            }

            return appInfoList;
        } else {
            return null;
        }
    }

    public static BaseModuleDataItemBean parseMainModuleJsonObject(Context context, int virtualModuleId, JSONObject mainModuleJsonObject) {
        if (mainModuleJsonObject != null && mainModuleJsonObject.length() > 0) {
            JSONObject jsonObject = null;
            if (mainModuleJsonObject.has(String.valueOf(virtualModuleId))) {
                try {
                    jsonObject = mainModuleJsonObject.getJSONObject(String.valueOf(virtualModuleId));
                } catch (Exception var12) {
                    var12.printStackTrace();
                }
            }

            if (jsonObject == null) {
                jsonObject = mainModuleJsonObject;
            }

            BaseModuleDataItemBean mainModuleDataItemBean = parseModuleJsonObject(context, virtualModuleId, jsonObject);
            if (mainModuleDataItemBean == null) {
                return null;
            } else {
                List<BaseModuleInfoBean> childModuleInfoList = mainModuleDataItemBean.getChildModuleList();
                BaseModuleDataItemBean moduleDataItemBean = null;
                if (childModuleInfoList != null && !childModuleInfoList.isEmpty()) {
                    List<BaseModuleDataItemBean> childModuleDataItemList = new ArrayList();
                    Iterator var8 = childModuleInfoList.iterator();

                    while(var8.hasNext()) {
                        BaseModuleInfoBean childModuleInfoBean = (BaseModuleInfoBean)var8.next();
                        if (childModuleInfoBean != null && mainModuleJsonObject.has(String.valueOf(childModuleInfoBean.getModuleId()))) {
                            try {
                                moduleDataItemBean = parseModuleJsonObject(context, virtualModuleId, mainModuleJsonObject.getJSONObject(String.valueOf(childModuleInfoBean.getModuleId())));
                                if (moduleDataItemBean != null) {
                                    childModuleDataItemList.add(moduleDataItemBean);
                                }
                            } catch (Exception var11) {
                                var11.printStackTrace();
                            }
                        }
                    }

                    mainModuleDataItemBean.mChildModuleDataItemList = childModuleDataItemList;
                }

                if (mainModuleJsonObject.has("saveDataTime")) {
                    mainModuleDataItemBean.mSaveDataTime = mainModuleJsonObject.optLong("saveDataTime", 0L);
                }

                if (mainModuleJsonObject.has("hasShowAdUrlList")) {
                    mainModuleDataItemBean.mHasShowAdUrlList = mainModuleJsonObject.optString("hasShowAdUrlList", "");
                }
                return mainModuleDataItemBean;
            }
        } else {
            return null;
        }
    }

    public static BaseModuleDataItemBean parseModuleJsonObject(Context context, int virtualModuleId, JSONObject moduleJsonObject) {
        if (moduleJsonObject != null && moduleJsonObject.length() > 0) {
            BaseModuleDataItemBean moduleDataItemBean = new BaseModuleDataItemBean();
            moduleDataItemBean.mModuleId = moduleJsonObject.optInt("moduleId", 0);
            moduleDataItemBean.mAdvPositionId = moduleJsonObject.optInt("advpositionid", 0);
            moduleDataItemBean.mModuleName = moduleJsonObject.optString("moduleName", "");
            moduleDataItemBean.mModuleDesc = moduleJsonObject.optString("moduleDesc", "");
            moduleDataItemBean.mModuleSubTitle = moduleJsonObject.optString("moduleSubtitle", "");
            moduleDataItemBean.mBackImage = moduleJsonObject.optString("backImage", "");
            moduleDataItemBean.mBanner = moduleJsonObject.optString("banner", "");
            moduleDataItemBean.mPreview = moduleJsonObject.optString("preview", "");
            moduleDataItemBean.mIcon = moduleJsonObject.optString("icon", "");
            moduleDataItemBean.mUrl = moduleJsonObject.optString("url", "");
            moduleDataItemBean.mShowRandom = moduleJsonObject.optInt("showrandom", 0);
            moduleDataItemBean.mActType = moduleJsonObject.optInt("acttype", 0);
            moduleDataItemBean.mSequence = moduleJsonObject.optInt("sequence", 0);
            moduleDataItemBean.mPreLoadSwitch = moduleJsonObject.optInt("preloadswitch", 0);
            moduleDataItemBean.mPreLoadSwitchType = moduleJsonObject.optInt("preloadswitchtype", 0);
            moduleDataItemBean.mAdFrequency = moduleJsonObject.optInt("adfrequency", 0);
            moduleDataItemBean.mAdSplitInner = moduleJsonObject.optInt("adsplit_inner", 0);
            moduleDataItemBean.mClickEffect = moduleJsonObject.optInt("click_effect", 0);
            moduleDataItemBean.mAdfirst = moduleJsonObject.optInt("adfirst", 0);
            moduleDataItemBean.mAdsplit = moduleJsonObject.optInt("adsplit", 0);
            moduleDataItemBean.mAdcolsetype = moduleJsonObject.optInt("adcolsetype", 0);
            moduleDataItemBean.mOnlineAdvPositionId = moduleJsonObject.optInt("onlineadvpositionid", 0);
            moduleDataItemBean.mEffect = moduleJsonObject.optInt("effect", 0);
            moduleDataItemBean.mAdvDataSource = moduleJsonObject.optInt("advdatasource", 0);
            JSONObject advDataSourceExtInfo = moduleJsonObject.optJSONObject("advdatasourceextinfo");
            moduleDataItemBean.mAdvScene = moduleJsonObject.optInt("advscene", 0);
            moduleDataItemBean.mFbAdvCount = moduleJsonObject.optInt("fbadvcount", 0);
            moduleDataItemBean.mAdvDataSourceType = moduleJsonObject.optInt("advdatasourcetype", 0);
            String fbIds = moduleJsonObject.optString("fbid", "");
            moduleDataItemBean.mFbIds = TextUtils.isEmpty(fbIds) ? null : fbIds.split("#");
            moduleDataItemBean.mFbAdvPos = moduleJsonObject.optInt("fbadvpos", 0);
            moduleDataItemBean.mFbTabId = moduleJsonObject.optString("fbtabid", "");
            moduleDataItemBean.mFbNumperLine = moduleJsonObject.optInt("fbnumperline", 0);
            moduleDataItemBean.mHasAnimation = moduleJsonObject.optInt("hasanimation", 0);
            moduleDataItemBean.mFbAdvAbplan = moduleJsonObject.optInt("fbadvabplan", 0);
            moduleDataItemBean.mAdMobBanner = moduleJsonObject.optInt("admobbanner", 0);
            moduleDataItemBean.mOnlineAdvType = moduleJsonObject.optInt("onlineadvtype", 3);
            moduleDataItemBean.mDataVersion = (long)moduleJsonObject.optInt("dataVersion", 0);
            moduleDataItemBean.mDataType = moduleJsonObject.optInt("dataType", 1);
            moduleDataItemBean.mLayout = moduleJsonObject.optInt("layout", 0);
            moduleDataItemBean.mAdCacheFlag = moduleJsonObject.optInt("adcache_flag");
            moduleDataItemBean.mIsVideo = moduleJsonObject.optInt("is_video");
            moduleDataItemBean.mIsTransfer = moduleJsonObject.optInt("is_transfer", 0);
            moduleDataItemBean.mPages = moduleJsonObject.optInt("pages", 0);
            moduleDataItemBean.mPageId = moduleJsonObject.optInt("pageid", 0);
            moduleDataItemBean.mStatisticsType = moduleJsonObject.optInt("statisticstype", 0);
            moduleDataItemBean.mClearflag = moduleJsonObject.optInt("clearflag", 0);
            moduleDataItemBean.mRefreshDuration = moduleJsonObject.optLong("refresh_time_split");
            moduleDataItemBean.mDuliteRefreshDuration = moduleJsonObject.optLong("dilute_refresh");
            moduleDataItemBean.mAdidRelation = moduleJsonObject.optString("adid_relation");
            if (moduleDataItemBean.mDataType == 1 && moduleJsonObject.has("childmodules")) {
                moduleDataItemBean.mChildModuleList = BaseModuleInfoBean.parseJsonArray(context, moduleJsonObject.optJSONArray("childmodules"), virtualModuleId);
            }

            if (moduleJsonObject.has("contents")) {
                moduleDataItemBean.mContentResourceInfoList = BaseContentResourceInfoBean.parseJsonArray(context, moduleJsonObject.optJSONArray("contents"), virtualModuleId, moduleDataItemBean.mModuleId, moduleDataItemBean.mAdvPositionId, moduleDataItemBean.mAdvDataSource);
            }

            moduleDataItemBean.setVirtualModuleId(virtualModuleId);

            return moduleDataItemBean;
        } else {
            return null;
        }
    }

    public static boolean saveAdDataToSdcard(int virtualModuleId, JSONObject cacheDataJsonObject) {
        if (cacheDataJsonObject != null && cacheDataJsonObject.length() >= 1) {
            if (!cacheDataJsonObject.has("saveDataTime")) {
                try {
                    cacheDataJsonObject.put("saveDataTime", System.currentTimeMillis());
                } catch (Exception var4) {
                    var4.printStackTrace();
                }
            }

            try {
//                return FileCacheUtils.saveCacheDataToSdcard(getCacheFileName(virtualModuleId), StringUtils.toString(cacheDataJsonObject), true);
            } catch (Exception var3) {
                var3.printStackTrace();
                return false;
            }
        } else {

        }
        return false;
    }

    public static AdModuleInfoBean getOfflineAdInfoList(Context context, int virtualModuleId, int adCount, boolean needShownFilter, BaseModuleDataItemBean currenModuleDataItemBean, JSONObject moduleDataItemJsonObj) {
        BaseModuleDataItemBean mainModuleDataItemBean = parseMainModuleJsonObject(context, virtualModuleId, moduleDataItemJsonObj);
        List<BaseModuleDataItemBean> childModuleDataItemList = null;
        if (mainModuleDataItemBean != null) {
            childModuleDataItemList = mainModuleDataItemBean.getChildModuleDataItemList();
            if (childModuleDataItemList == null || ((List)childModuleDataItemList).isEmpty()) {
                if (childModuleDataItemList == null) {
                    childModuleDataItemList = new ArrayList();
                }

                ((List)childModuleDataItemList).add(mainModuleDataItemBean);
            }
        }

        if (childModuleDataItemList != null && !((List)childModuleDataItemList).isEmpty()) {
            List<BaseAppInfoBean> adAppInfoList = null;
            List<BaseAppInfoBean> appInfoList = null;
            int availableCount = 0;
            boolean isRequestData = true;
            BaseModuleDataItemBean offineModuleDataItemBean = null;
            Iterator var13 = ((List)childModuleDataItemList).iterator();

            while(var13.hasNext()) {
                BaseModuleDataItemBean childModuleDataItemBean = (BaseModuleDataItemBean)var13.next();
                if (currenModuleDataItemBean == null || !currenModuleDataItemBean.isOfflineAdType() || currenModuleDataItemBean.getModuleId() == childModuleDataItemBean.getModuleId()) {
                    offineModuleDataItemBean = childModuleDataItemBean;
                    appInfoList = childModuleDataItemBean != null ? childModuleDataItemBean.getAppInfoList() : null;
                    if (appInfoList != null && !appInfoList.isEmpty()) {
                        if (!childModuleDataItemBean.isOfflineAdType() && currenModuleDataItemBean != null && currenModuleDataItemBean.getModuleId() == childModuleDataItemBean.getModuleId()) {
                            BaseModuleDataItemBean lastAdModuleDataItemBean = (BaseModuleDataItemBean)((List)childModuleDataItemList).get(((List)childModuleDataItemList).size() - 1);
                            if (lastAdModuleDataItemBean != null && lastAdModuleDataItemBean.isOfflineAdType()) {
                                continue;
                            }
                        }

                        String hasShowAdUrls = mainModuleDataItemBean.getHasShowAdUrlList();
                        List<String> installAppList = new ArrayList();
                        Iterator var17 = appInfoList.iterator();

                        BaseAppInfoBean appInfoBean;
                        label152:
                        while(true) {
                            do {
                                do {
                                    if (!var17.hasNext()) {
                                        break label152;
                                    }

                                    appInfoBean = (BaseAppInfoBean)var17.next();
                                } while(appInfoBean == null);

                                if (adAppInfoList == null) {
                                    adAppInfoList = new ArrayList();
                                }
                            } while(needShownFilter && !TextUtils.isEmpty(hasShowAdUrls) && hasShowAdUrls.indexOf("||" + appInfoBean.getAdUrl() + "||") >= 0);

//                            if (AppUtils.isAppExist(context, appInfoBean.getPackageName())) {
//                                installAppList.add(appInfoBean.getPackageName());
//                            } else {
//                                if (adCount > 0 && adAppInfoList.size() >= adCount) {
//                                    isRequestData = false;
//                                    break;
//                                }
//
//                                adAppInfoList.add(appInfoBean);
//                            }
                        }

                        if (((List)childModuleDataItemList).size() == 1) {
                        } else {
                            if (adAppInfoList != null && adAppInfoList.size() < adCount) {
                                try {
                                    moduleDataItemJsonObj.put("hasShowAdUrlList", "");
                                    saveAdDataToSdcard(virtualModuleId, moduleDataItemJsonObj);
                                } catch (Exception var19) {
                                    var19.printStackTrace();
                                }

                                var17 = appInfoList.iterator();

                                while(var17.hasNext()) {
                                    appInfoBean = (BaseAppInfoBean)var17.next();
                                    if (appInfoBean != null && !adAppInfoList.contains(appInfoBean) && !installAppList.contains(appInfoBean.getPackageName())) {
                                        adAppInfoList.add(appInfoBean);
                                        if (adCount > 0 && adAppInfoList.size() >= adCount) {
                                            break;
                                        }
                                    }
                                }
                            }

                            isRequestData = false;
                        }
                        break;
                    }
                }
            }

            if (offineModuleDataItemBean != null) {
//                AdModuleInfoBean adInfoBean = new AdModuleInfoBean();
//                offineModuleDataItemBean.setBaseResponseBean(currenModuleDataItemBean != null ? currenModuleDataItemBean.getBaseResponseBean() : null);
//                adInfoBean.setOfflineAdInfoList(context, offineModuleDataItemBean, adAppInfoList);
//                adInfoBean.setIsRequestData(isRequestData);
//                if (adAppInfoList != null && adAppInfoList.size() > 0 && LogUtils.isShowLog()) {
//                    Iterator var21 = adAppInfoList.iterator();
//
//                    while(var21.hasNext()) {
//                        BaseAppInfoBean appInfo = (BaseAppInfoBean)var21.next();
//                        if (appInfo != null) {
//                            LogUtils.d("Ad_SDK", "[vmId:" + virtualModuleId + "]return offline ad info::>(count:" + adAppInfoList.size() + "--" + adCount + ", VirtualModuleId:" + appInfo.getVirtualModuleId() + ", ModuleId:" + appInfo.getModuleId() + ", MapId:" + appInfo.getMapId() + ", packageName:" + appInfo.getPackageName() + ", Name:" + appInfo.getName() + ", availableCount:" + availableCount + ", mAdvDataSourceType:" + offineModuleDataItemBean.getAdvDataSourceType() + ")");
//                        }
//                    }
//                }

//                return adInfoBean;
            } else {
                return null;
            }
        } else {

        }
        return null;
    }

    public static boolean checkControlInfoValid(long loadDataTime) {
        return loadDataTime <= 0L || loadDataTime > System.currentTimeMillis() - 14400000L;
    }

    public static String getCacheFileName(int virtualModuleId) {
        return StringUtils.toString(virtualModuleId);
    }

    public static boolean isBannerAd(BaseModuleDataItemBean moduleDataItemBean) {
        return moduleDataItemBean != null && 1 == moduleDataItemBean.getOnlineAdvType();
    }

    public static boolean isBannerAd300_250(BaseModuleDataItemBean moduleDataItemBean) {
        return moduleDataItemBean != null && 5 == moduleDataItemBean.getOnlineAdvType();
    }

    public static boolean isInterstitialAd(BaseModuleDataItemBean moduleDataItemBean) {
        return moduleDataItemBean != null && 2 == moduleDataItemBean.getOnlineAdvType();
    }

    public static boolean isNativeAd(BaseModuleDataItemBean moduleDataItemBean) {
        return moduleDataItemBean != null && 3 == moduleDataItemBean.getOnlineAdvType();
    }

    public BaseResponseBean getBaseResponseBean() {
        return this.mBaseResponseBean;
    }

    public void setBaseResponseBean(BaseResponseBean mBaseResponseBean) {
        this.mBaseResponseBean = mBaseResponseBean;
    }

    public String getStatistics105Remark() {
        BaseResponseBean baseResponseBean = this.getBaseResponseBean();
        String remark = "-1";
        if (baseResponseBean != null) {
            remark = baseResponseBean.isNormalChannel() ? baseResponseBean.getUser() : baseResponseBean.getBuychanneltype();
        }

        return remark;
    }

    public int getIsVideo() {
        return this.mIsVideo;
    }

    public boolean isTransferId() {
        return this.mIsTransfer == 1;
    }
}